<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019\6\10 0010
 * Time: 10:29
 */
namespace BigVideo\IMooc;

use BigVideo\IMooc\UserStorage\UserManager;

/**
 * 单例模式 只创建一次数据库连接
 * Class Database
 * @package BigVideo\IMooc
 */
class Database
{
    /**
     * @var UserManager
     */
    protected static $db;

    /**
     * @return UserManager
     */
    static function getInstance()
    {
        if(empty(self::$db))return self::$db;
        self::$db = new self();
        return self::$db;
    }
}